package org.example.mapper;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.example.pojo.userdto.CustomerLoginDTO;
import org.example.pojo.entity.Customer;

@Mapper
public interface CustomerMapper {

    @Insert("insert into customer( user, password, email) values (#{user},#{password},#{email})")
    public void insertCustomer(Customer customer);

    @Select("select * from customer where (user=#{user} or email=#{user})  and password=#{password}")
    public Customer getCustomer(CustomerLoginDTO customerLoginDTO);

    @Delete("delete from customer where id = #{id}")
    public void delete(Long id);

    @Select("SELECT * FROM customer where id = #{id}")
    public Customer getCustomerById(Long id);

}
